//
//  ZHPothoCell.m
//  图片浏览器
//
//  Created by 李智恒 on 16/3/29.
//  Copyright © 2016年 Zhli. All rights reserved.
//

#import "NBDiscoverCell.h"
#import "NBDiscoverItem.h"
#import "UIImageView+WebCache.h"

@interface NBDiscoverCell ()

@property (weak, nonatomic) IBOutlet UIImageView *imageView;

@property (weak, nonatomic) IBOutlet UILabel *titleLable;

@property (weak, nonatomic) IBOutlet UILabel *priceLable;

@property (weak, nonatomic) IBOutlet UILabel *mallNameLable;

@property (weak, nonatomic) IBOutlet UILabel *pubDateLable;

@end

@implementation NBDiscoverCell

-(void)setItems:(NBDiscoverItem *)items
{
    _items=items;
    
    NSURL *url=[NSURL URLWithString:items.cover];
    
    [self.imageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:nil]];
    self.titleLable.text=items.title;
    
    self.priceLable.text=items.price;
    
    self.mallNameLable.text=items.mallName;
    
//    NSString *str = [items.pubDate substringToIndex:10];
//    
//    NSLog(@"%@",str);
    
//    NSDate *confromTimesp = [NSDate dateWithTimeIntervalSince1970:str];
    

    
//    self.pubDateLable.text=[NSString stringWithFormat:@"%@",confromTimesp];
    
    
//    NSLog(@"%@",[NSString stringWithFormat:@"%@",confromTimesp]);
    
    
//    NSTimeInterval time = [[NSDate date] timeIntervalSince1970];
    // NSTimeInterval返回的是double类型，输出会显示为10位整数加小数点加一些其他值
    // 如果想转成int型，必须转成long long型才够大。
    NSTimeInterval time = [[NSDate date] timeIntervalSince1970];
    
    long long dTime = [[NSNumber numberWithDouble:time] longLongValue]; // 将double转为long long型
    
    NSDate *confromTimesp = [NSDate dateWithTimeIntervalSince1970:dTime];
    NSString *strTime=[[NSString stringWithFormat:@"%@",confromTimesp] substringToIndex:10];
    
    self.pubDateLable.text=strTime;


    NSLog(@"%@",confromTimesp);
}

//-(void)awakeFromNib
//{
//    [super awakeFromNib];
//    
//    // 添加Pan手势
//    UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)];
//    [scrollView addGestureRecognizer:pan];
//}

@end
